package message.types.string;

import java.io.IOException;

import network.e2e.FrameReader;
import stalker.Stalker;
import message.visitor.MessageVisitor;

public class GetRoomFromNameRequest extends StringMessage {

  /**
   * Constructs a retrieve stalker from name request
   * @requires parameters not null
   * @param client      The answerer
   * @param destination The recipient
   * @param name        name of the stalker. If not found does not return.
   */
  
  public GetRoomFromNameRequest(Stalker client, Stalker destination, String name) {
    super(client, destination, name);
  }
  
  public GetRoomFromNameRequest(Stalker client, Stalker destination, FrameReader reader) throws IOException {
    super(client, destination, reader);
  }
  
  public String getName() {
    return getString();
  }
  
  @Override
  public <T> T accept(MessageVisitor<T> visitor) {
    return visitor.visit(this);
  }

  @Override
  public boolean equals(Object obj) {
    if (!(obj instanceof GetRoomFromNameRequest)) {
      return false;
    }
    return super.contentEquals(obj);
  }

  @Override
  public String toString() {
    return "GetRoomFromNameRequest by " + this.getClient() + " for name : " + this.getName();
  }

}
